<script setup lang="ts">
import { ref, computed } from 'vue'

// 这个useStore是store/index.ts文件下面的定义自己的 `useStore` 组合式函数
import { useStore } from '@/store' 
const store = useStore()

const count222 = ref(123) // 定义一个响应式数据,在js值中需要.value方式去获取。模板中不需要.value
const showcount = computed(() => {
  // return store.getters['getCount']
  return store.getters['menu/getCount']
})
const addBtn = () => {
  // store.commit('setCount', ++count222.value)
  store.commit('menu/setCount', ++count222.value)
}
</script>

<template>

  <!-- store的演示demo -->
  <h1>{{ showcount }}</h1>

  <!-- <h2>{{ count }}</h2> -->
  
  <button type="button" @click="addBtn">新增</button>
</template>

<style scoped>

</style>
